package com.douqu.game.battle.route;


import com.douqu.game.core.util.LogUtils;

import java.util.LinkedList;

/**
 * @author wangzhenfei
 *         2018-01-16 15:31
 */
public class RouteQueue<T> {

    private LinkedList<T> data = new LinkedList<>();


    public void add(T t){
        synchronized (this){
            data.add(t);
            LogUtils.info("进入队列后->" + data.size());
            this.notifyAll();
        }
    }


    public T removeFirst(){
        synchronized (this) {
            LogUtils.info("即将要出队列->" + data.size());
            return data.removeFirst();
        }
    }

    public T removeLast(){
        synchronized (this) {
            return data.removeLast();
        }
    }

    public boolean isEmpty(){
        return data.isEmpty();
    }











}
